<!-- 03VueInstance.html -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
	<link rel="stylesheet" href="./css/common.css"/>
	<style>
		button {
			width: 60px;
			padding: 8px;
		}
	</style>
    <script src="https://cdn.bootcss.com/vue/2.6.10/vue.js"></script>
	<!-- <script src="https://cdn.bootcss.com/axios/0.19.0/axios.min.js"></script> -->
	<!-- <script src="https://cdn.bootcss.com/lodash.js/4.17.15/lodash.min.js"></script> -->
</head>
<body>
	<h2>slot</h2>
	<div id="demo">
		<component v-bind:is="whichcomp"></component>
		<button v-on:click="choosencomp('a')">a</button>
		<button v-on:click="choosencomp('b')">b</button>
		<button v-on:click="choosencomp('c')">c</button>
	</div>
    <script>
        var demo = new Vue({
			el: '#demo',
			components:{
				acomp:{
					template:`<p>这里是组件A</p>`
				},
				bcomp:{
					template:`<p>这里是组件B</p>`
				},
				ccomp:{
					template:`<p>这里是组件C</p>`
				}
			},
			data:{
				whichcomp: ''
			},
			methods: {
				choosencomp: function(x){
					this.whichcomp = x + "comp"
				}
			}
        });
    </script>
</body>
</html>